/* 公共模块 */

// 应用配置
import config from './config.js';

// 服务器地址
let server = config.production,
    develop_num = 1,
    develop_mode = uni.getStorageSync('develop_mode') || 0;
if (develop_mode == 1) {
    server = config.develop;
    develop_num = 16;
}

// 系统信息
const system = uni.getSystemInfoSync();

// 导航栏默认高度
let navHeight = '44px';

// 小程序胶囊信息
// #ifdef MP
const miniMenu = uni.getMenuButtonBoundingClientRect();
miniMenu.bigWidth = ((system.windowWidth - miniMenu.left) + (system.windowWidth - miniMenu.right)) +
    'px'; // 自定义导航 为胶囊留出的宽度
navHeight = (miniMenu.height + (miniMenu.top - system.statusBarHeight) * 2) + 'px'; // 自定义导航 为胶囊留出的高度 
// #endif

// 页面滚动高度
let scrollTop = null;

// 工具模块
import {
    show,
    jump,
    adJump,
    getBrowserPlatform,
    getRandom,
    getOutTradeNo,
    getTime,
    fixZero,
    query,
    getUUID,
    isType,
    toArray,
    changeDevelopMode,
    getDateRange,
    countDown
} from './utils.js';

// 请求模块
import {
    get,
    post,
    put,
    del,
    request
} from './request.js';

// // 验证模块
// import {
//     validate
// } from './validate.js';

// 计算模块
import {
    add,
    sub,
    mul,
    div,
    rem
} from './calculator.js';

// 公共方法模块
import {
    checkLogin,
    sendSms,
    uploadOss,
    favourite,
    distribution,
    textCopy,
    phoneReplace,
    pay,
    formatMsgTime,
    openMap
} from './methods.js';

export default {
    config,
    server,
    develop_mode,
    develop_num,
    system,
    navHeight,
    // #ifdef MP
    miniMenu,
    // #endif
    scrollTop,
    show,
    jump,
    adJump,
    getBrowserPlatform,
    getRandom,
    getOutTradeNo,
    getTime,
    fixZero,
    query,
    getUUID,
    isType,
    toArray,
    changeDevelopMode,
    get,
    post,
    put,
    del,
    request,
    // validate,
    add,
    sub,
    mul,
    div,
    rem,
    checkLogin,
    sendSms,
    uploadOss,
    favourite,
    distribution,
    textCopy,
    phoneReplace,
    getDateRange,
    countDown,
    pay,
    formatMsgTime,
    openMap
}